#include <iostream>
#include <vector>
#include <string>
#include "Meld.h"
#include "Run.h"
#include "Group.h"
#include "Card.h"
#include "Set.cpp"
#include "SetIter.cpp"

using std::string;
using std::ostream;
using std::cout;
using std::endl;
using std::vector;

int main(void){

  Set<Card> cSet1;
  cSet1.add(Card("1D"));
  cSet1.add(Card("4C"));
  cSet1.add(Card(6,"Hearts"));
  cSet1.add(Card(10,"Clubs"));  
  cSet1.add(Card(3,"Diamonds"));
  cSet1.add(Card(7,"Spades"));
  
  cout<<"cSet1: "<<cSet1<<endl;

  Meld meld1(cSet1);
  cout<<"meld1: "<<meld1<<endl;
  cout<<"Validity: "<<meld1.validify()<<endl;
  
  Set<Card> cSet2;

  //cSet2.add(Card(1,"Clubs"));
  //cSet2.add(Card(2,"Clubs"));
  cSet2.add(Card(3,"Clubs"));
  cSet2.add(Card(4,"Clubs"));
  cSet2.add(Card(5,"Clubs"));
  cSet2.add(Card(6,"Clubs"));
  cSet2.add(Card(7,"Clubs"));
  cSet2.add(Card(8,"Clubs"));
  cSet2.add(Card(9,"Clubs"));
  cSet2.add(Card(10,"Clubs"));
  //cSet2.add(Card(11,"Clubs"));
  //cSet2.add(Card(12,"Clubs"));
  //cSet2.add(Card(13,"Clubs"));
  //cSet2.add(Card(1,"Clubs"));
  
  cout<<"cSet2: "<<cSet2<<endl;

  Meld meld2(cSet2);
  cout<<"meld2: "<<meld2<<endl;
  cout<<"Validity: "<<meld2.validify()<<endl;
  
  Set<Card> cSet3;
  cSet3.add(Card(1,"Diamonds"));
  cSet3.add(Card(1,"Clubs"));
  cSet3.add(Card(1,"Hearts"));
  cSet3.add(Card(1,"Spades"));
  
  cout<<"cSet3: "<<cSet3<<endl;
  Meld meld3(cSet3);

  cout<<"Validity: "<<meld3.validify()<<endl;

  Meld meld4 = *(meld2.split(4));
  Meld meld5 = *(meld2.split(10));
  Meld meld6 = *(meld2.split(2));
  
  cout<< meld6 << endl;
  cout<<"2: "<< meld2 << endl;

  cout<<"VALID2: "<<meld2.getValidCards()<<endl;

  Set<Card> cSet4;
  cSet4.add(Card(1,"Clubs"));
  cSet4.add(Card(2,"Clubs"));
  cSet4.add(Card(3,"Clubs"));
  cSet4.add(Card(4,"Clubs"));
  cSet4.add(Card(5,"Clubs"));
  cSet4.add(Card(6,"Clubs"));
  cSet4.add(Card(7,"Clubs"));
  cSet4.add(Card(8,"Clubs"));
  cSet4.add(Card(9,"Clubs"));
  //  cSet4.add(Card(1,"Clubs"));
  cSet4.add(Card(10,"Clubs"));
  cSet4.add(Card(11,"Clubs"));
  cSet4.add(Card(12,"Clubs"));
  cSet4.add(Card(13,"Clubs"));  
  
  cout<<"cSet4: "<<cSet4<<endl;

  Run run4(cSet4);

  Set<Card> cSet5;
  cSet5.add(Card(1,"Diamonds"));
  cSet5.add(Card(1,"Spades"));
  cSet5.add(Card(1,"Hearts"));
  
  cout<<"cSet5: "<<cSet5<<endl;
  Group group5(cSet5);
  
  cout<<"VALIDRUN: "<<run4.getValidCards()<<endl;
  cout<<"VALIDGROUP: "<<group5.getValidCards()<<endl;

  vector<Meld> thisMelds;
  thisMelds.push_back(run4);
  thisMelds.push_back(group5);

  cout<<"VALIDRUN: "<<thisMelds[0].getValidCards()<<endl;
  cout<<"VALIDGROUP: "<<thisMelds[1].getValidCards()<<endl;

  vector<Meld*> thisMeldp;
  thisMeldp.push_back(&run4);
  thisMeldp.push_back(&group5);
  cout<<"VALIDRUN: "<<thisMeldp[0]->getValidCards()<<endl;
  cout<<"VALIDGROUP: "<<thisMeldp[1]->getValidCards()<<endl;

  
}
